package com.feng.controller;

import com.feng.domain.ResponseResult;
import com.feng.service.OssUpLoadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
public class UploadController {

    @Autowired
    private OssUpLoadService upLoadService;

    @PostMapping("/upload")
    public ResponseResult upload(MultipartFile img){
        try {
            return upLoadService.upLoad(img);
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("文件上传失败");
        }
    }
}
